/**
 * 获取url参数
 */
function getParams(url) {
    let params = {};
    let index = url.indexOf('?');
    if (index > -1) {
        let str = url.substring(index + 1);
        let arr = str.split('&');
        arr.forEach(item => {
            let temp = item.split('=');
            params[temp[0]] = temp[1];
        });
    }
    return params;
}

/**
 * 获取最后一截路径
 */
function getLastPath(url) {
    try{
        let index = url.lastIndexOf('/');
        return url.substring(index + 1);
    }catch (e){
        return null;
    }
}

export default {
    getParams,
    getLastPath
}